package com.th.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * 钱包状态 0正常 1停用
 * @author 第五组
 * @Description TODO
 * @createTime 2023-06-24 16:41
 */
@AllArgsConstructor
@Getter
public enum WalletStatus {
    YES(0,"正常"),
    NO(1,"停用");
    private Integer code;
    private String name;

    /***
     * 获取当前类型
     * @param code
     * @return
     */
    public static WalletStatus of(Integer code){
        return Stream.of(values()).
                filter(bean -> bean.code.equals(code))
                .findAny()
                .orElse(null);
    }
}
